﻿using System.Collections.Generic;
using System;
using System.Linq;
using RMH.Entities;
using RMH.Services;

namespace RMH.Web.FakeServices
{
    public class FakeStaffMemberService : IStaffMemberService
    {
        private readonly List<StaffMember> _staffMembers = new List<StaffMember>() {
            new StaffMember() { Id = 1, UserName="JSmith", FirstName="John", LastName="Smith", Type = StaffType.Admin, EncryptedPassword="&#($&#(*&ffsjl" },
            new StaffMember () { Id = 2, UserName="JJackson", FirstName="Jenny", LastName="Jackson", Type= StaffType.Volunteer, EncryptedPassword="3sO9434j=-/" } 
        };

        #region IStaffMemberService Members

        public StaffMember Get(int id)
        {
            return _staffMembers.Where(s => s.Id == id).FirstOrDefault();
        }

        public IList<StaffMember> Search(string firstName, string lastName)
        {
            return _staffMembers.Where(p => (String.IsNullOrEmpty(firstName) || p.FirstName == firstName) && (String.IsNullOrEmpty(lastName) || p.LastName == lastName)).ToList();
        }

        public void Save(StaffMember staffMember)
        {
            throw new System.NotImplementedException();
        }

        public IList<StaffMember> GetAll()
        {
            return _staffMembers;
        }

        #endregion
    }
}